;(function(){
var role = require("./role");
var ResponObj = require("../_include/responObj");
var city_list = require("../_include/city/city.json");
module.exports = {
	prefix:"/city",
	get:{
		//获取三级城市列表
		"/:parent_id":function(){
			var parent_id = this.params.parent_id;
			var arr = new Array();
			arr = parent_id.split(":");
			var pid = arr[1];
			var _ab = city_list;
			var list = "[";
			var j = 0;
			for(i in _ab){
	    		if(_ab[i].parent_id == pid){
	    			var d = j==0?'':',';
	    			list+=d+'{"region_id":"'+ _ab[i].region_id+'","region_name":"'+_ab[i].region_name+'"}';
	    			j++;
	    		}
    		}
    		list = list+"]";
			this.body = ResponObj("json",JSON.parse(list));
			console.log(list);
		}
	}
}	
}());